/**
 * @file bind_core.h
 *
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * Description: bind core headfile
 * Author: huawei
 * Create: 2020-11-16
 */

#ifndef _IRQ_BIND_CORE_H_
#define _IRQ_BIND_CORE_H_

#include <linux/of.h>
#include <linux/cpumask.h>
#include <linux/interrupt.h>
#include <linux/printk.h>

#define bind_core_err(fmt, ...)      printk(KERN_ERR " [irq_bind_core] [%s %d] " fmt, __func__, __LINE__, ##__VA_ARGS__)
#define bind_core_info(fmt, ...)     printk(KERN_INFO " [irq_bind_core] [%s %d] " fmt, __func__, __LINE__, ##__VA_ARGS__)

/**
 * @irq:        Interrupt to set affinity
 * @irq_node_name:  The node name that defined to bind irq to core
 * @irq_cpu_name:   The property name that contains cpus
 *
 * Bind irq to one or more cores. Returns 0 if bound irq to cores on success,
 * -1 if bound it failed.
 * To use this headfile, establish a soft link in module's file,
 * and add it in the module's Makefile.
 */
int bind_irq_to_core(unsigned int irq, const char *irq_node_name, const char *irq_cpu_name);

#endif
